package com.seaboxdata.dao;

import org.apache.ibatis.annotations.*;

import java.util.List;
import java.util.Map;

@Mapper
public interface YtcDao {

    @Delete("truncate table cantonList")
    Boolean delCantonList();

    @Insert("")
    Boolean insertCantonList(List<Map<String,Object>> cantonLists);

    @Select("")
    String selectCantonByName(String name);


    @Delete("truncate table cantonList")
    Boolean delAreaList();

    @Insert("<script>" +
            "insert into sytc_ytc.arealist (AreaId,AreaName,cjsj,cantonId) " +
            "values " +
            "<foreach collection='areaLists' item='areaList' index='index' separator=','>" +
            "(#{areaList.AreaId},#{areaList.AreaName},#{areaList.cjsj},#{areaList.cantonId})" +
            "</foreach>" +
            "</script>")
    Boolean insertAreaList(List<Map<String,Object>> areaLists);
    @Select("")
    String selectAreaListByName(String name);




    @Delete("truncate table cantonList")
    Boolean delSectionList();

    @Insert("<script>" +
            "insert into sytc_ytc.sectionList (SectionLatitude,SectionName,SectionLongitude,SectionId,cjsj) " +
            "values " +
            "<foreach collection='sectionLists' item='sectionList' index='index' separator=','>" +
            "(#{sectionList.SectionLatitude},#{sectionList.SectionName},#{sectionList.SectionLongitude},#{sectionList.SectionId},,#{sectionList.cjsj})" +
            "</foreach>" +
            "</script>")
    Boolean insertSectionList(List<Map<String,Object>> sectionLists);


    @Delete("truncate table cantonList")
    Boolean delBerthList();

    @Insert("<script>" +
            "insert into sytc_ytc.berthList (AreaName,ManufacturerName,PricingStrategyName,BerthAndBerthType,SetPosition,LineDirection,ParkStatus,BerthStatus,CantonName,SectionName,BerthCode,cjsj) " +
            "values " +
            "<foreach collection='berthListLists' item='berthListList' index='index' separator=','>" +
            "(#{berthListList.AreaName},#{berthListList.ManufacturerName},#{berthListList.PricingStrategyName},#{berthListList.BerthAndBerthType},#{berthListList.SetPosition},#{berthListList.LineDirection},#{berthListList.ParkStatus},#{berthListList.BerthStatus},#{berthListList.CantonName},#{berthListList.SectionName},#{berthListList.BerthCode},#{berthListList.cjsj})" +
            "</foreach>" +
            "</script>")
    Boolean insertBerthList(List<Map<String,Object>> berthListLists);

    @Delete("truncate table cantonList")
    Boolean delNearRTCInfo();

    @Insert("<script>" +
            "insert into sytc_ytc.sectionList (SectionLatitude,SectionName,SectionLongitude,SectionId,cjsj) " +
            "values " +
            "<foreach collection='sectionLists' item='sectionList' index='index' separator=','>" +
            "(#{sectionList.SectionLatitude},#{sectionList.SectionName},#{sectionList.SectionLongitude},#{sectionList.SectionId},,#{sectionList.cjsj})" +
            "</foreach>" +
            "</script>")
    Boolean insertNearRTCInfo(List<Map<String,Object>> NearRTCInfos);

    @Delete("truncate table cantonList")
    Boolean delRTCPrice();
    @Insert("<script>"  +
            " insert into sytc_ytc.rtcprice (PricingStrategyName,WorkPricing,NoWorkPricing,IsAllow,ParkTime,DateType,cjsj) n" +
            " values " +
            " <foreach collection='RTCPrices' item='rtcprice' index='index' separator=','>" +
            " (#{rtcprice.PricingStrategyName},#{rtcprice.WorkPricing},#{rtcprice.NoWorkPricing},#{rtcprice.IsAllow},#{rtcprice.ParkTime},#{rtcprice.DateType},#{rtcprice.cjsj})" +
            " </foreach>" +
            " </script>")
    Boolean insertRTCPrice(List<Map<String,Object>> RTCPrices);


    @Delete("truncate table cantonList")
    Boolean delConstantlyBerth();

    @Insert("<script>"  +
            " insert into sytc_ytc.constantlyberth (LoadIndex,UseCount,AreaId,CantonId,BerthVacant,AreaName,NotUsedCount,SectionLatitude,BerthTotal,TotalCounts,CantonName,SectionName,SectionLongitude,SectionId,cjsj,) n" +
            " values " +
            " <foreach collection='ConstantlyBerths' item='constantlyBerth' index='index' separator=','>" +
            " (#{constantlyBerth.LoadIndex},#{constantlyBerth.UseCount},#{constantlyBerth.AreaId},#{constantlyBerth.CantonId},#{constantlyBerth.BerthVacant},#{constantlyBerth.AreaName},#{constantlyBerth.NotUsedCount},#{constantlyBerth.SectionLatitude},#{constantlyBerth.BerthTotal},#{constantlyBerth.TotalCounts},#{constantlyBerth.CantonName},#{constantlyBerth.SectionName},#{constantlyBerth.SectionLongitude},#{constantlyBerth.SectionId},#{constantlyBerth.cjsj})" +
            " </foreach>" +
            " </script>")
    Boolean insertConstantlyBerth(List<Map<String,Object>> ConstantlyBerths);
}
